<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page import="MyServlet.Candidate2"%>
<%@ page import="MyServlet.Position2"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<link type="text/css" href="css/menu.css" rel="stylesheet" />
<link type="text/css" href="css/jquery-ui-1.10.0.custom.min.css"
	rel="stylesheet" />
<link type="text/css" href="css/menu.css" rel="stylesheet" />
<link type="text/css" href="css/popup.css" rel="stylesheet" />
<script
	src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.10.0.custom.min.js"></script>
<script type="text/javascript" src="js/jquery.leanModal.min.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>

<script>
	$(function() {
		$("#tabs").tabs();
	});
</script>

</head>
<body>
	<div id="tabs">
		<ul>
			<li><a href="#tabs-1">Positions</a></li>
			<li><a href="#tabs-2">Approve candidates</a></li>
		</ul>

		<div id="tabs-1">
			<div id="myDiv2">
				<a style="float: left;" href="#loginmodal" class="flatbtn"
					id="modaltrigger"><button>+</button></a>

				<div id="loginmodal" class="popupMany" style="display: none;">
					<h1>Add position</h1>
					<form id="loginform" name="loginform" method="POST"
						action="CrudPosition">
						<label>Position name:</label> <input type="text"
							name="positionName" id="positionName" class="txtfield"
							tabindex="1"> <label>Total places:</label> <input
							type="text" name="totalPlaces" id="totalPlaces" class="txtfield"
							tabindex="2"> <label>Project:</label> <input type="text"
							name="project" id="project" class="txtfield" tabindex="2">

						<label>Requirements:</label>
						<textarea style="resize: none;" name="requirements" rows="4"
							cols="30">
			   </textarea>

						<label for="password">Department:</label> <select
							name="department">
							<option value="gba">GBA</option>
							<option value="gbc">GBC</option>
							<option value="msa">MSA</option>
							<option value="mng">MNG</option>
						</select> <label>Responsibilities:</label>
						<textarea style="resize: none;" name="responsibilities" rows="4"
							cols="30">
			</textarea>

						<br> <br>
						<div class="center">
							<input type="submit" id="loginbtn" class="flatbtn-blu hidemodal"
								name='option' value='add'>
						</div>
					</form>
				</div>
				<br> <br>

				<c:if test="${!empty approvedPositionList }">
					<c:forEach items="${approvedPositionList}" var="position">
						<div>
							<form action="CrudPosition" method="POST">
								<input style="visibility: hidden" class="inputtext" type="text"
									name="id" value="${position.id}" />
								<table style="border-bottom-style: solid;">
									<tr>
										<td>
											<table>
												<tr>
													<td>Name: ${position.name}</td>
												</tr>
												<tr>
													<td>Total places: ${position.totalPlaces}</td>
												</tr>
												<tr>
													<td>Project: ${position.project}</td>
												</tr>
												<tr>
													<td>Requirements: ${position.requirements}</td>
												</tr>
												<tr>
													<td>Department: ${position.department["name"]}</td>
												</tr>
												<tr>
													<td>Responsibilities: ${position.responsibilities}</td>
												</tr>
												<tr>
													<td>Active: ${position.active}</td>
												</tr>

											</table>
										</td>
										<td><img src="images/user.jpg" height="150" width="250"></td>
										<td>
											<table>
												<tr>
													<td>Name:</td>
													<td><input class="inputtext" type="text" name="name" /></td>
												</tr>
												<tr>
													<td>Total places:</td>
													<td><input class="inputtext" type="text"
														name="totalPlaces" /></td>
												</tr>
												<tr>
													<td>Project:</td>
													<td><input class="inputtext" type="text"
														name="project" /></td>
												</tr>
												<tr>
													<td>Requirements:</td>
													<td><input class="inputtext" type="text"
														name="requirements" /></td>
												</tr>
												<tr>
													<td>Department:</td>
													<td><select name="function">
															<option value="gba">GBA</option>
															<option value="gbc">GBC</option>
															<option value="msa">MSA</option>
															<option value="mng">MNG</option>
													</select></td>
												</tr>
												<tr>
													<td>Responsibilities:</td>
													<td><input class="inputtext" type="text"
														name="responsibilities" /></td>
												</tr>
											</table>

										</td>
										<td><input type="submit" tabindex="4" name='option'
											value='update' /></td>
									</tr>
								</table>
							</form>
						</div>
					</c:forEach>
				</c:if>
			</div>
		</div>
		<div id="tabs-2">
			<c:if test="${!empty approvedPositionList }">
				<c:forEach items="${approvedPositionList}" var="position">
					<div>
						<form action="CrudPosition" method="POST">
							<input style="visibility: hidden" class="inputtext" type="text"
								name="positionid" value="${position.id}" />
							<table style="border-bottom-style: solid;">
								<tr><br>
									<td>Position name: ${position.name}</td>
								</tr>
								<tr>
									<c:if test="${!empty position.candidates }">
										<c:forEach items="${position.candidates}" var="candidate">
											<input style="visibility: hidden" class="inputtext"
												type="text" name="candidateid" value="${candidate.id}" />
											<tr>
												<td>Candidate name: ${candidate.firstName}</td>
												<td><input type="checkbox" name="active" value="${candidate.id}">Approve
													<br></td>

											</tr>
										</c:forEach>
									</c:if>
									<td><input type="submit" tabindex="4" name='option'
											value='approveCan' /></td>
								</tr>
							</table>
						</form>
					</div>
				</c:forEach>
			</c:if>
		</div>

	</div>

</body>
</html>